import axios from 'axios'

// 接口地址
const baseURL = 'https://paotui.ddptkfw.com/home/api/'

/**
 * 封装get方法
 * @param url
 * @param data
 * @returns {Promise}
 */
export function get(data) {
  console.log(data)
  return new Promise((resolve, reject) => {
    axios({
        url: baseURL + 'dsdsd/111/1111/1111/111/111',
        method: 'GET'
      })
      .then(res => {
        resolve(res.data);
      })
      .catch(err => {
        reject(err)
      })
  })
}

/**
 * 封装post请求
 * @param url
 * @param data
 * @returns {Promise}
 */
export function post(data) {
  return new Promise((resolve, reject) => {
    axios({
        url: baseURL + data.url,
        method: 'POST',
        data: data.data
      })
      .then(res => {
        resolve(res.data);
      })
      .catch(err => {
        reject(err)
      })
  })
}
